package com.wsx.springai.controller;

import com.alibaba.fastjson.JSONObject;
import com.wsx.springai.service.PsNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 新闻控制器，提供新闻相关的API接口
 * ^
 * @author Craft^
 */
@RestController
@RequestMapping("/api/news")
public class NewsController {

    private final PsNewsService psNewsService;

    @Autowired
    public NewsController(PsNewsService psNewsService) {
        this.psNewsService = psNewsService;
    }

    /**
     * 获取新闻列表^
     * ^
     * @return 新闻列表数据^
     */
    @GetMapping("/list")
    public List<JSONObject> getNewsList(String stockName, String date) {
        return psNewsService.getNewsList(stockName, date);
    }
} 